Skip to content

Move _union into Conjunction.__call__#297

Closed
ValerianRey wants to merge 1 commit intomainfrom
move-union
Closed

Move _union into Conjunction.__call__#297
ValerianRey wants to merge 1 commit intomainfrom
move-union

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey commented Apr 3, 2025

Since _union is only used in Conjunction.__call__, it makes sence to define it in base.py (where Conjunction is defined). Further, since base.py contains several classes, it makes sence to make _union a static method of specifically the Conjunction class. Lastly, since Conjunction.__call__ is almost a trivial call to _union, it makes sense to have no _union method but to directly compute this union in the __call__ method of Conjunction. This is kind of the opposite of a factorization, but it should enhance code readability since it limits the back-and-forth required to understand a piece of code.

Do you agree @PierreQuinton?

@ValerianRey ValerianRey added package: autojac cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements labels Apr 3, 2025
@ValerianRey ValerianRey self-assigned this Apr 3, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/torchjd/autojac/_transform/_utils.py 100.00% <100.00%> (ø)
src/torchjd/autojac/_transform/base.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValerianRey ValerianRey changed the title Develop _union into Conjunction.__call__ Move _union Apr 3, 2025
@ValerianRey ValerianRey changed the title Move _union Move _union into Conjunction.__call__ Apr 3, 2025
@ValerianRey
Copy link
Copy Markdown
Contributor Author

Closing this in favor of the more complete PR #298

@ValerianRey ValerianRey closed this Apr 3, 2025
@ValerianRey ValerianRey deleted the move-union branch April 4, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: autojac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant